<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>纪念馆</title>
    <link rel="stylesheet" href="../css/anniversary.css?version=1.1">
    <link rel="stylesheet" href="../css/elindex.css">
    <script src="../js/moment.min.js"></script>
    <script src="../js/vue.js"></script>
    <script src="../js/elindex.js"></script>
    <script src="../components/christmasTree.js"></script>
    <script src="../components/newYear.js"></script>
    <style>
        * {
            padding: 0;
            margin: 0;
        }

        .source-code {
            position: absolute;
            top: 0;
            right: 0;
            display: block;
            background-color: #ff0000;
            color: white;
            font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
            font-weight: normal;
            padding: 8px;
            text-decoration: none;
            border-radius: 3px;
        }

        #scene {
            display: inline-block;
            width: 100% !important;
            position: fixed;
            left: 0;
            top: 50%;
            transform: translateY(-50%);
            z-index: 0;
            opacity: .3;
        }

        #canvas {
            display: inline-block;
            width: 100% !important;
            position: fixed;
            left: 0;
            top: 50%;
            transform: translateY(-50%);
            z-index: 0;
            opacity: .3;
        }

        .z-index1{
            z-index: 1;
            position: sticky;
        }
    </style>
</head>
<body>
    <div id="app">

        <div @click="goindex()" class="el-icon-arrow-left z-index1"></div>
        <div class="time-box">
            <h2>
                <div class="day-left">第一次见面</div>
                <div v-text="meetDay" class="day-h2"></div>
                <div class="day-right">天</div>
            </h2>
            <h2>
                <div class="day-left">相恋</div>
                <div v-text="loveDay" class="day-h2"></div>
                <div class="day-right">天</div>
            </h2>
        </div>
        <div class="timeline-box z-index1">
            <el-timeline>
                <el-timeline-item
                    v-for="(activity, index) in activities"
                    :key="index"
                    :icon="activity.icon"
                    :color="activity.color"
                    size="large"
                    :timestamp="activity.timestamp">
                    {{activity.content}}
                </el-timeline-item>
            </el-timeline>
        </div>
        
        <christmas-tree id="scene" v-if="christmasData.isShow"></christmas-tree>
        <new-year id="canvas" v-show="newYearData.isShow"></new-year>
    </div>

    <script>
        var app = new Vue({
            el:"#app",
            data:{
                activities: [
                    {
                        content: '重庆之旅',
                        timestamp: '2023-03-30 18:30',
                        icon: 'el-icon-hot-water',
                        color: '#15559a'
                    },{
                        content: '叔叔阿姨、舅舅来青岛了，双方会晤',
                        timestamp: '2023-02-04 10:30',
                        icon: 'el-icon-data-board',
                        color: '#15559a'
                    },{
                        content: '去嘉嘉家里跨年',
                        timestamp: '2022-12-31 15:30',
                        icon: 'el-icon-ice-drink',
                        color: '#15559a'
                    },{
                        content: '我们的双方父母见面了，风雨无阻',
                        timestamp: '2022-10-07 11:30',
                        icon: 'el-icon-goblet-square-full',
                        color: '#15559a'
                    },{
                        content: '我们的一周年，去方特玩到晕晕',
                        timestamp: '2022-08-21 10:00',
                        icon: 'el-icon-wind-power',
                        color: '#15559a'
                    },{
                        content: '第一次去小猪家里做客，见到了叔叔阿姨、小姨姨父、姥姥姥爷、妹妹',
                        timestamp: '2022-06-18 15:00 - 2022-06-19 17:00',
                        icon: 'el-icon-sunny',
                        color: '#15559a'
                    },{
                        content: '因为小x经常经常不回小猪，而吵架的两周',
                        timestamp: '2022-04-18 左右两周',
                        icon: 'el-icon-cloudy-and-sunny',
                        color: '#15559a'
                    },{
                        content: '一天来了',
                        timestamp: '2022-03-20 中午',
                        icon: 'el-icon-present',
                        color: '#15559a'
                    },{
                        content: '我们的第一次旅行-北京',
                        timestamp: '2022-01-01',
                        icon: 'el-icon-guide',
                        color: '#15559a'
                    },{
                        content: '小猪搬家搬到我隔壁！在家一起吃火锅！',
                        timestamp: '2021-12-11 晚',
                        icon: 'el-icon-hot-water',
                        color: '#15559a'
                    },{
                        content: '难忘~今宵~',
                        timestamp: '2021-12-04 晚',
                        icon: 'el-icon-office-building',
                        color: '#15559a'
                    },{
                        content: '我们在一起啦',
                        timestamp: '2021-08-21 23:59',
                        icon: 'el-icon-moon-night',
                        color: '#15559a'
                    },{
                        content: '淄博火车站遇见你',
                        timestamp: '2021-07-14 20:16',
                        icon: 'el-icon-moon',
                        color: '#15559a'
                    }
                ],
                meetDay: 0,
                loveDay: 0,
                // 圣诞
                christmasData: {
                    isShow: false,
                    date: ['12-21', '12-22', '12-23', '12-24', '12-25'],
                },
                // 元旦
                newYearData: {
                    isShow: false,
                    date: ['12-30', '12-31', '01-01', '01-02', '01-03'],
                },
            },
            created(){
                var today = new Date();
                today = today.getTime();

                var meetTime = new Date("2021/07/14 20:16");
                meetTime = meetTime.getTime();

                var loveTime = new Date("2021/08/21 23:59");
                loveTime = loveTime.getTime();
                
                var datemeet = today - meetTime;
                var datelove = today - loveTime;

                this.meetDay = Math.floor(datemeet/(24*3600*1000));
                this.loveDay = Math.floor(datelove/(24*3600*1000));

                // 圣诞特辑
                this.christmasData.isShow = this.christmasData.date.some( el => el == moment(new Date()).format('MM-DD') ); 
                // 元旦特辑
                this.newYearData.isShow = this.newYearData.date.some( el => el == moment(new Date()).format('MM-DD') ); 
            },
            methods:{
                goindex(){
                    window.location.href = "./index.html";
                },
            }
        })
    </script>
    <script src='../js/fscreen.js'></script>
    <script src='../js/Stage.js'></script>
    <script src='../js/MyMath.js'></script>
    <script src="../js/script.js"></script>
</body>
</html>